/**********************************************************************************************/
/* FBL_I_Task.h 		                                                      				  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006															  */
/* All Rights Reserved                                                   					  */
/**********************************************************************************************/

#ifndef _FBL_I_Task_h 
	#define _FBL_I_Task_h
#pragma once

// FBL:
#include <VShared/FBL/publ/Sets/FBL_Set.h>

// FINAL:
#include <VShared/FBL/publ/Headers/FBL_pre_header.h>


/**********************************************************************************************/
FBL_Begin_Namespace


/**********************************************************************************************/
SMART_INTERFACE(I_Task);


/**********************************************************************************************/
SMART_ARRAY_OF_SMART_PTRS( TaskArray, I_Task_Ptr );


/**********************************************************************************************/
// interface FBL_SHARED_EXP_CLASS class
//
interface FBL_SHARED_EXP_CLASS I_Task : public I_Unknown
{
	// ---------------------
	// Types:

	enum EState { 
		Ready, 			// The task is prepared but was not yet started.
		Running, 		// the task now execute Run() command.
		Finished, 		// The task have finish its work. We can obtain results.
		Canceled		// The task was canceled by user. Result not exists.
	};

	// ---------------------
	// Construction:

virtual 					~I_Task( void );

	// ---------------------
	// Properties:
	
		// <Name>
							/// The name of a task.
virtual const String&		get_Name( void ) const throw() = 0; //KEEPAS: mName
virtual void				put_Name( const String& inName ) throw() = 0;

		// <State>
virtual	EState				get_State( void ) const throw() = 0;
virtual void				put_State( EState inState ) throw() = 0;

		// <Error>
							/// The last error during execution of this task. 
virtual long				get_Error( void ) const throw()  = 0;		
virtual void				put_Error( long inError ) throw() = 0;

		// <AffectRows>
							/// If we want that task remember records it have affect,
							/// then we must specify Set to be used for this.
virtual Set_Ptr				get_AffectedRecords( void ) const throw() = 0;
virtual void				put_AffectedRecords( 
								Set_Ptr 	inSet ) = 0;

		// <Completion>
							/// Returns completion for this task in the range 0.0 - 1.0
virtual double				get_Completion( void ) const throw() = 0;


	// ---------------------
	// Methods:
	
							/// This function must execute work of this task.
virtual	void				Run( void ) throw() = 0;	

							/// Task must be explicitly destroyed by 
							/// calling this method .
virtual	void				Destroy( void ) throw() = 0;	

};


/**********************************************************************************************/
FBL_End_Namespace

#include <VShared/FBL/publ/Headers/FBL_post_header.h>

#endif // _FBL_I_Task_h
